<?php
namespace app\api\controller;
use app\common\BaseController;
use think\Db;
use app\api\model\Organization as OrganizationModel;

class Organization extends BaseController{
    public function __construct(OrganizationModel $organizationModel){
        parent::__construct();   
        $this->model = $organizationModel;    
    }
    //查询指定数据
    public function read(){        
        $params = $this->request->param();        
        if(empty($params['id'])){
            return '缺少id参数';
        }      
        
        $data = $this->model->where('id',$params['id'])->find();
        return $data ;
    }
    //更新
    public function update(){
        $param = $this->request->param();   
        
        $data = $this->model->allowField(true)->save($param,['id',$param['id']]);       
        return $this->model;
    }  
    
}
